/*************************************************************
 * File: OperationType.java
 * Copyright (c) 2012
 * Author: Huang Shaobin
 * Email: Shaobin.Software@gmail.com Shaobin_Software@163.com 
 * Date: Feb 2, 2013
 * Description: 
 ************************************************************/

package snow.core.security;

/**
 * 操作类型
 * 
 * @author Shaobin.Software@gmail.com Shaobin_Software@163.com
 * @version 1.0
 */
public enum OperationType {

	SEARCH(0x1), CREATE(0x2), REMOVE(0x4), MODIFY(0x8);

	public static OperationType toOperationTypeFrom(int value) {
		OperationType operationType = null;
		switch (value) {
		case 0x1: {
			operationType = OperationType.SEARCH;
			break;
		}
		case 0x2: {
			operationType = OperationType.CREATE;
			break;
		}
		case 0x4: {
			operationType = OperationType.REMOVE;
			break;
		}
		case 0x8: {
			operationType = OperationType.MODIFY;
			break;
		}
		default:
			break;
		}
		return operationType;
	}

	private final int value;

	private OperationType(int value) {
		this.value = value;
	}

	public int getValue() {
		return this.value;
	}

}
